package giromba.display
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class ResizeableSpriteBase extends Sprite
	{
		private var _width:Number = 0;
		private var _height:Number = 0;
		
		public function ResizeableSpriteBase()
		{
			super();
		}
		
		public function show():void{
			render();
		}
		
		public function hide():void{
			render();
		}
		
		protected function update():void{
			addEventListener(Event.EXIT_FRAME, updateListener);
		}
		
		private function updateListener(event:Event):void{
			removeEventListener(Event.EXIT_FRAME, updateListener);
			render();
		}
		
		protected function render():void{
			
		}

		override public function get width():Number
		{
			return _width;
		}

		override public function set width(value:Number):void
		{
			_width = value;
			update();
		}

		override public function get height():Number
		{
			return _height;
		}

		override public function set height(value:Number):void
		{
			_height = value;
			update();
		}


	}
}